package bishi.kuaishou;

import java.util.*;

public class demo2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        String s = in.nextLine();
        String dict = "";
        if(in.hasNextLine()){
            dict = in.nextLine();

        }else {
            System.out.println("False");
        }
        Map<Integer,String> map = new HashMap<>();
        String[] words = dict.split(" ");

        for(String x : words) {
            int sum = 0;
            for(int i = 0;i < x.length();i++) {
                char temp = x.charAt(i);
                sum = sum + (temp-'a');
            }
            map.put(sum,x);
        }

        int left = 0;
        int right = 0;
        int sum = 0;
        while(right < s.length()) {
            sum += s.charAt(right)-'a';
            if(map.containsKey(sum)) {
                left = right;
                sum = 0;
            }
            right++;
        }
        if(left == right-1) {
            System.out.println("True");
        }else {
            System.out.println("False");
        }
    }
}
